﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CC.UI
{
    public partial class CcSlider : UserControl
    {
        [Category("数据"), Browsable(true), Description("当前值")]
        public float Value
        {
            get { return ccSliderNoTitle1.Value; }
            set { ccSliderNoTitle1.Value = value; }
        }
        [Category("数据"), Browsable(true), Description("最大值")]
        public float Maximum
        {
            get { return ccSliderNoTitle1.Maximum; }
            set { ccSliderNoTitle1.Maximum = value; }
        }
        [Category("数据"), Browsable(true), Description("最小值")]
        public float Minimum
        {
            get { return ccSliderNoTitle1.Minimum; ; }
            set { ccSliderNoTitle1.Minimum = value; }
        }
        [Category("数据"), Browsable(true), Description("调节步长")]
        public float Step
        {
            get { return ccSliderNoTitle1.Step; ; }
            set { ccSliderNoTitle1.Step = value; }
        }
        [Category("行为"), Browsable(true), Description("标尺频度")]
        /// <summary>
        /// 刻度频度
        /// </summary>
        public float TickFrequency
        {
            get { return ccSliderNoTitle1.TickFrequency; ; }
            set { ccSliderNoTitle1.TickFrequency = value; }
        }
        [Category("行为"), Browsable(true), Description("鼠标在滑动条两侧点击时的数值步长")]
        /// <summary>
        /// 每次鼠标在滑动条两侧点击时的数值步长
        /// </summary>
        public float LargeChange
        {
            get { return ccSliderNoTitle1.LargeChange; ; }
            set { ccSliderNoTitle1.LargeChange = value; }
        }
        [Category("行为"), Browsable(true), Description("使用键盘光标键时的数值步长")]
        /// <summary>
        /// 每次使用键盘光标键时的数值步长
        /// </summary>
        public float SmallChange
        {
            get { return ccSliderNoTitle1.SmallChange; ; }
            set { ccSliderNoTitle1.SmallChange = value; }
        }
        public new string Name { 
            get { return ccSliderNoTitle1.Name; }
            set { ccSliderNoTitle1.Name = value; }
        }
        public CcSlider()
        {
            InitializeComponent();
           
        }
        public CcSlider(string name, double max = 3, double min = 0, double step = 0.1)
        {
            ccSliderNoTitle1 = new CcSliderNoRowTitle(name, max, min, step);
        }
        private void CcSlider_Load(object sender, EventArgs e)
        {
            
        }

        private void CcSlider_Resize(object sender, EventArgs e)
        {
            if (Height > this.MinimumSize.Height)
            {
                ccSliderNoTitle1.Height = Height - 6;
                lbMin.Location = new Point(15, ccSliderNoTitle1.TextMinLocation.Y+6);
                lbStep.Location = new Point(9, ccSliderNoTitle1.TextStepLocation.Y+6);
            }
        }
    }
}
